Skip to content

[NAE-2446] Migration for NAE v7 phase 1#448

Merged
machacjozef merged 8 commits into
release/7.0.0-rev10from
NAE-2446
Jun 16, 2026
Merged

[NAE-2446] Migration for NAE v7 phase 1#448
machacjozef merged 8 commits into
release/7.0.0-rev10from
NAE-2446

Conversation

@renczesstefan

@renczesstefan renczesstefan commented Jun 3, 2026

Copy link
Copy Markdown
Member

Description

Implements NAE-2446

Dependencies

No new dependencies were introduced

Third party dependencies

  • No new dependencies were introduced

Blocking Pull requests

There are no dependencies on other PR

How Has Been This Tested?

This was tested manually and with unit tests.

Test Configuration

Name Tested on
OS macOS Tahoe 26.3
Runtime Java 21
Dependency Manager Maven 3.9.9n
Framework version Spring Boot 3.4.4
Run parameters
Other configuration

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes have been checked, personally or remotely, with @machacjozef
  • I have commented my code, particularly in hard-to-understand areas
  • I have resolved all conflicts with the target branch of the PR
  • I have updated and synced my code with the target branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes:
    • Lint test
    • Unit tests
    • Integration tests
  • I have checked my contribution with code analysis tools:
  • I have made corresponding changes to the documentation:
    • Developer documentation
    • User Guides
    • Migration Guides

Summary by CodeRabbit

New Features

  • Added comprehensive bulk migration capabilities for cases, tasks, and workflow models, including pagination and cursor-based updates.
  • Introduced configurable data field transformations during workflow migrations (type/value conversions, choice updates, file field migration).
  • Added role and permission synchronization between migrated workflow models and existing cases/tasks, including options to ignore roles when reapplying a workflow.
  • Implemented flexible migration error handling with collection/reporting and selectable stop/continue strategies.
  • Added Elasticsearch reindexing for migrated cases and tasks.

Tests

  • Added integration tests covering end-to-end migrations and error-policy behavior.

Added comprehensive test cases for the `nae_2432` process migration. Introduced `MigrationHelper` to facilitate data field addition, transition updates, and error handling during migrations. Created `MigrationError` to encapsulate migration failure states with detailed metadata. Updated PetriNet versions from v1.0 to v2.0 and verified seamless case migration, role updates, and task modifications.
Update migration tests: rename PetriNet files and identifiers from `nae_2432` to `migration_test`
Remove unused `webEnvironment` property from Elastic test annotations
- Add support for case removal synchronized between MongoDB and Elasticsearch in `MigrationHelper` and `CaseMigrationHelper`.
- Introduce `updateCasesCursor` for ObjectId-based case updates.
- Refactor and streamline `migratePetriNet` logic to update case IDs.
- Implement MongoDB bulk operations with upsert using `FindAndReplaceOptions`.
- Update migration tests with constants, improved assertions, and enhanced logic.
@renczesstefan renczesstefan self-assigned this Jun 3, 2026
@renczesstefan renczesstefan added the improvement A change that improves on an existing feature label Jun 3, 2026
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@renczesstefan, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 34 minutes and 45 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 148ed011-868c-4556-b64a-790689644978

📥 Commits

Reviewing files that changed from the base of the PR and between 837a70b and 020b4a0.

📒 Files selected for processing (16)
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/MigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/AbstractMigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/CaseMigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/PetriNetMigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/TaskMigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/model/MigrationError.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/model/MigrationErrorHandlingMode.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/model/MigrationErrorPolicy.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/throwable/MigrationErrorException.groovy
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/MigrationProperties.java
  • application-engine/src/main/java/com/netgrif/application/engine/utils/MongodbUtils.java
  • application-engine/src/test/groovy/com/netgrif/application/engine/elastic/ElasticSearchTest.groovy
  • application-engine/src/test/groovy/com/netgrif/application/engine/elastic/ElasticTaskTest.groovy
  • application-engine/src/test/groovy/com/netgrif/application/engine/migration/MigrationTest.groovy
  • application-engine/src/test/resources/petriNets/migration_test_v1.xml
  • application-engine/src/test/resources/petriNets/migration_test_v2.xml

Walkthrough

This PR introduces a comprehensive MongoDB migration framework for bulk document operations on Cases, Tasks, and Petri Nets. It includes configurable error handling policies, QueryDSL predicate support, pagination with cursor streaming, and Elasticsearch integration for case/task indexing. The framework provides a public facade (MigrationHelper) that orchestrates specialized helpers while managing thread-local error policies and centralizing error caching across subsystems.

Changes

Migration System Implementation

Layer / File(s) Summary
Error handling model and configuration
application-engine/src/main/groovy/com/netgrif/application/engine/migration/model/MigrationError*.groovy, application-engine/src/main/groovy/com/netgrif/application/engine/migration/model/MigrationErrorPolicy.groovy, application-engine/src/main/groovy/com/netgrif/application/engine/migration/throwable/MigrationErrorException.groovy, application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/MigrationProperties.java
MigrationError model captures error details with timestamp and cause; MigrationErrorHandlingMode enum defines four strategies (THROW_IMMEDIATELY, CONTINUE, THROW_AFTER_LIMIT, THROW_AFTER_PROCESSING); MigrationErrorPolicy encapsulates configuration with factory methods; MigrationErrorException wraps immutable error lists; MigrationProperties binds configuration for cases/tasks/petri nets with nested page size and error policy settings.
MongoDB QueryDSL integration
application-engine/src/main/java/com/netgrif/application/engine/utils/MongodbUtils.java
Utility converts QueryDSL Predicate instances to Spring MongoDB Query objects via SpringDataMongodbQuery.
Abstract bulk migration infrastructure
application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/AbstractMigrationHelper.groovy
Generic AbstractMigrationHelper<T> handles pagination, document streaming from MongoDB cursor, bulk operation batching, error caching, and policy-driven exception routing; subclasses implement page size, operation preparation, and entity ID resolution.
Case migration with Elasticsearch indexing
application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/CaseMigrationHelper.groovy
CaseMigrationHelper extends abstract base for Case documents with filtering/iteration/cursor-based updates, Elasticsearch indexing with retry logic when lastModified is missing, and static utilities for dataset transformations (field deletion, value conversion, choice updates, file-field conversion), permission synchronization from Petri nets, case removal, and net migration.
Petri Net migration with role remapping
application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/PetriNetMigrationHelper.groovy
PetriNetMigrationHelper extends abstract base for PetriNet documents with model re-import from resources, role/permission remapping using importId while preserving existing role references, dataset sorting, transition role permission updates, role creation (per-net and global), role event synchronization, and utilities for extracting dataset component maps.
Task migration with permission updates
application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/TaskMigrationHelper.groovy
TaskMigrationHelper extends abstract base for Task documents with predicate-based and process-specific cursor queries (optionally filtered by transition IDs), task reloading, Elasticsearch indexing with error handling, bulk role additions, and permission updates synchronized from Petri net transitions.
Public migration facade with thread-local policy management
application-engine/src/main/groovy/com/netgrif/application/engine/migration/MigrationHelper.groovy
MigrationHelper Spring component orchestrates all three specialized helpers via delegation, manages active error policy per thread via currentErrorPolicy ThreadLocal with withErrorPolicy(...), and provides centralized error access (getErrors, popErrors, clearErrors, hasErrors, collectErrors). Delegates case/task/net migrations while passing active policy; includes static/instance wrappers for dataset transforms and component operations.
Integration tests and Petri net fixtures
application-engine/src/test/groovy/com/netgrif/application/engine/migration/MigrationTest.groovy, application-engine/src/test/resources/petriNets/migration_test_v*.xml
MigrationTest validates end-to-end migrations of cases from v1 to v2, net updates with role remapping, task role additions, and error policies (throwImmediately, throwAfterLimit, throwAfterProcessing, continueOnError); XML fixtures define two Petri net versions with transitions, places, data fields, and roles for migration scenarios.
Test configuration cleanup
application-engine/src/test/groovy/com/netgrif/application/engine/elastic/ElasticSearchTest.groovy, application-engine/src/test/groovy/com/netgrif/application/engine/elastic/ElasticTaskTest.groovy
Removed redundant webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT annotation parameters.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • netgrif/application-engine#422: Complements this PR by using the MigrationProperties configuration to control cache eviction, shutdown behavior, and migration skipping in MigrationOrderedCommandLineRunner.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'NAE-2446 Migration for NAE v7 phase 1' clearly and concisely summarizes the main change: implementing migration support for NAE v7 phase 1, referencing the associated ticket NAE-2446.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added the Large label Jun 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/AbstractMigrationHelper.groovy`:
- Around line 53-58: Update the field Javadoc for migrationErrors in
AbstractMigrationHelper to reflect that it is a List<MigrationError> (not a
map): describe that migrationErrors is a collection holding MigrationError
entries encountered during migration, each representing an individual migration
failure; remove references to keys, string identifiers, and lists-per-key, and
adjust any thread-safety wording to match the actual implementation (e.g., note
whether the list is synchronized or not) so the comment accurately matches the
migrationErrors field.
- Around line 192-194: The Javadoc block in AbstractMigrationHelper is malformed
because the first line of the comment lacks the leading "*" and runs into the
next line; update the Javadoc for the method (the comment starting at the block
above the iterator/bulk-operation method in class AbstractMigrationHelper) by
adding the missing "*" at the start of the first line so each line begins with
"*" and the comment renders correctly as a standard Javadoc block.
- Around line 226-266: The outer catch in the iterate loop is re-invoking
handleMigrationError for exceptions that have already been routed (and possibly
re-thrown) by prepareOperations or effectiveProcessOperations, which causes
double-handling and masks original errors; modify the catch block around the
cursor iteration so it checks for MigrationErrorException (or a marker that
handleMigrationError already threw) and rethrows it immediately without calling
handleMigrationError again, and only call handleMigrationError for other
unexpected exceptions (so keep references to prepareOperations,
effectiveProcessOperations, handleMigrationError, MigrationErrorException and
finishMigrationErrorPolicy to locate the logic).
- Around line 317-321: The THROW_AFTER_LIMIT branch incorrectly throws
immediately when policy.maxErrors == 0 and bypasses throwOriginal; change the
logic in the MigrationErrorHandlingMode.THROW_AFTER_LIMIT case to first treat
maxErrors==0 as "no limit" (i.e. only apply the limit when policy.maxErrors > 0)
and when the limit is reached call the central throwError(...) path instead of
directly throwing new MigrationErrorException so throwOriginal and cacheErrors
behavior are honored; specifically update the condition around
getErrors().size() and policy.maxErrors to require policy.maxErrors > 0 and
route handling through throwError(...) (respecting cacheErrors and existing
error caching) rather than constructing/throwing MigrationErrorException inline.

In
`@application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/CaseMigrationHelper.groovy`:
- Around line 448-450: The error logging and error handler call in removeCase
are mislabelled: update the message string and the handleMigrationError
operation parameter to reference "removeCase" (or "removeCase: delete case"
phrasing) instead of "migratePetriNet"; specifically modify the local variable
message and the handleMigrationError(errorPolicy, "migratePetriNet", type,
useCase.stringId, message) invocation in the removeCase method so both
accurately reflect removeCase while keeping errorPolicy, type and
useCase.stringId unchanged.

In
`@application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/MigrationProperties.java`:
- Around line 143-147: The docs say maxErrors == 0 means "no limit" but the
handler throws immediately because it checks getErrors().size() >=
policy.maxErrors; update AbstractMigrationHelper.handleMigrationError to treat 0
as unlimited by changing the throw condition to only apply when policy.maxErrors
> 0 (e.g., require policy.maxErrors > 0 && getErrors().size() >=
policy.maxErrors), keeping existing behavior for positive limits and preserving
references to getErrors(), policy.maxErrors, and the THROW_AFTER_LIMIT policy.

In
`@application-engine/src/main/java/com/netgrif/application/engine/utils/MongodbUtils.java`:
- Around line 9-15: MongodbUtils currently exposes only the static method
toQuery but is instantiable; make the intent explicit by adding a private
constructor to MongodbUtils (e.g., private MongodbUtils() { throw new
AssertionError("No instances."); } or simply private MongodbUtils() {} ) so
callers cannot instantiate the class; update class MongodbUtils to include this
private constructor while leaving the static toQuery(MongoTemplate, Class<T>,
Predicate...) unchanged.

In
`@application-engine/src/test/groovy/com/netgrif/application/engine/migration/MigrationTest.groovy`:
- Around line 69-104: The beforeEach setup resets the DBs but not the
centralized migration error cache, causing flaky tests; add a call to clear the
error cache (e.g., migrationHelper.clearErrors() or the appropriate
clearErrors() method on the migration helper) immediately after
testHelper.truncateDbs() inside the beforeEach method so the shared error state
is reset before importing nets and creating cases, ensuring
migrationHelper.hasErrors() checks in other tests are not impacted by prior
runs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4ceca0d7-f7c3-4af9-9ed4-eec4c19742fd

📥 Commits

Reviewing files that changed from the base of the PR and between 837a70b and 4bca04f.

📒 Files selected for processing (16)
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/MigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/AbstractMigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/CaseMigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/PetriNetMigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/TaskMigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/model/MigrationError.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/model/MigrationErrorHandlingMode.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/model/MigrationErrorPolicy.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/throwable/MigrationErrorException.groovy
  • application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/MigrationProperties.java
  • application-engine/src/main/java/com/netgrif/application/engine/utils/MongodbUtils.java
  • application-engine/src/test/groovy/com/netgrif/application/engine/elastic/ElasticSearchTest.groovy
  • application-engine/src/test/groovy/com/netgrif/application/engine/elastic/ElasticTaskTest.groovy
  • application-engine/src/test/groovy/com/netgrif/application/engine/migration/MigrationTest.groovy
  • application-engine/src/test/resources/petriNets/migration_test_v1.xml
  • application-engine/src/test/resources/petriNets/migration_test_v2.xml
💤 Files with no reviewable changes (2)
  • application-engine/src/test/groovy/com/netgrif/application/engine/elastic/ElasticSearchTest.groovy
  • application-engine/src/test/groovy/com/netgrif/application/engine/elastic/ElasticTaskTest.groovy

- Update error handling logic in `CaseMigrationHelper` and `AbstractMigrationHelper`, including better handling of migration limits and error policies.
- Replace error map with a thread-safe `CopyOnWriteArrayList` in migration processes.
- Add safeguards for `MigrationErrorException` handling.
- Make `MongodbUtils` a utility class with a private constructor to prevent instantiation.
- Enhance migration tests with error clearing before execution.
@renczesstefan renczesstefan changed the title [NAE-2446] Migration for NAE v7 [NAE-2446] Migration for NAE v7 phase 1 Jun 3, 2026
- Correct parameter names and error messages in `CaseMigrationHelper` and `AbstractMigrationHelper`.
- Simplify query and bulk operation processing logic with early return on empty counts.
- Update role reference replacement methods: rename `replaceUserFieldRoleReferences` to `replaceActorFieldRoleReferences`.
- Adjust `MigrationErrorPolicy` logic to allow zero error limits.
- Enhance `PetriNetMigrationHelper` to utilize `ImportPetriNetParams` for reimport functionality.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/CaseMigrationHelper.groovy (1)

190-219: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Null check is ineffective—NPE thrown before it executes.

Line 193 passes petriNetService.get(useCase.petriNetObjectId) to setPetriNet. If the service returns null, PetriNetMigrationHelper.setPetriNet will throw a NullPointerException when constructing the new PetriNet(net) at line 487 of PetriNetMigrationHelper—before the null check at line 194 can execute.

Move the null check before calling setPetriNet:

🐛 Proposed fix
     void elasticIndex(Case useCase, MigrationErrorPolicy errorPolicy = defaultErrorPolicy()) {
         log.debug("Starting elasticIndex for case: ${useCase.stringId}")
         try {
-            PetriNetMigrationHelper.setPetriNet(useCase, petriNetService.get(useCase.petriNetObjectId))
-            if (!useCase.petriNet) {
-                String message = "Failed to set petriNet for case $useCase.stringId"
+            PetriNet net = petriNetService.get(useCase.petriNetObjectId)
+            if (!net) {
+                String message = "PetriNet not found for case $useCase.stringId (petriNetObjectId: $useCase.petriNetObjectId)"
                 log.error(message)
                 handleMigrationError(errorPolicy, "elasticIndex", type, useCase.stringId, message)
                 return
             }
+            PetriNetMigrationHelper.setPetriNet(useCase, net)
             log.trace("Successfully set petriNet for case: ${useCase.stringId}")
             elasticCaseService.indexNow(elasticCaseMappingService.transform(useCase))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/CaseMigrationHelper.groovy`
around lines 190 - 219, The null check at line 194 in the elasticIndex method
executes too late to prevent a NullPointerException. The issue is that
petriNetService.get(useCase.petriNetObjectId) is passed directly to
PetriNetMigrationHelper.setPetriNet at line 193, and if the service returns
null, setPetriNet will throw an exception before the null check can run. Move
the null check before calling setPetriNet by first storing the result of
petriNetService.get(useCase.petriNetObjectId) in a variable, checking if it is
null, and only then calling PetriNetMigrationHelper.setPetriNet with that
non-null result. Keep the existing error handling logic intact.
application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/PetriNetMigrationHelper.groovy (1)

300-307: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Warning message references wrong entity.

Line 303 logs "Transition with importId $transitionId not found" but the code is checking whether the role (with roleImportId) was found, not the transition. The transition lookup happens later in the delegated method at line 285.

📝 Proposed fix
     static void updateTransitionRoles(PetriNet net, String transitionId, String roleImportId, Map<String, Boolean> permissions) {
         ProcessRole role = net.roles.values().find { it.importId == roleImportId }
         if (!role) {
-            log.warn("Transition with importId $transitionId not found in net $net.identifier")
+            log.warn("Role with importId $roleImportId not found in net $net.identifier")
             return
         }
         updateTransitionRoles(net, transitionId, role, permissions)
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/PetriNetMigrationHelper.groovy`
around lines 300 - 307, The warning log message in the updateTransitionRoles
method is logging incorrect information. The code checks whether a ProcessRole
with the given roleImportId exists, but the warning message incorrectly states
"Transition with importId $transitionId not found". Update the log.warn message
to correctly indicate that the role with roleImportId was not found, not the
transition. Change the message to reference roleImportId and clarify that it is
the role that could not be found in the net.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/CaseMigrationHelper.groovy`:
- Line 343: The JavaDoc comment for the toRemove parameter in the
CaseMigrationHelper class incorrectly describes the operation as "add" when it
should describe the operation as "remove". Update the `@param` toRemove
documentation to accurately reflect that the parameter contains a map of field
IDs to lists of choices to remove from the data field, not add.

---

Outside diff comments:
In
`@application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/CaseMigrationHelper.groovy`:
- Around line 190-219: The null check at line 194 in the elasticIndex method
executes too late to prevent a NullPointerException. The issue is that
petriNetService.get(useCase.petriNetObjectId) is passed directly to
PetriNetMigrationHelper.setPetriNet at line 193, and if the service returns
null, setPetriNet will throw an exception before the null check can run. Move
the null check before calling setPetriNet by first storing the result of
petriNetService.get(useCase.petriNetObjectId) in a variable, checking if it is
null, and only then calling PetriNetMigrationHelper.setPetriNet with that
non-null result. Keep the existing error handling logic intact.

In
`@application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/PetriNetMigrationHelper.groovy`:
- Around line 300-307: The warning log message in the updateTransitionRoles
method is logging incorrect information. The code checks whether a ProcessRole
with the given roleImportId exists, but the warning message incorrectly states
"Transition with importId $transitionId not found". Update the log.warn message
to correctly indicate that the role with roleImportId was not found, not the
transition. Change the message to reference roleImportId and clarify that it is
the role that could not be found in the net.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 226ef1e0-308d-40da-bba5-9cf7507640dc

📥 Commits

Reviewing files that changed from the base of the PR and between 4bca04f and c6bfbab.

📒 Files selected for processing (7)
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/AbstractMigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/CaseMigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/helpers/PetriNetMigrationHelper.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/model/MigrationError.groovy
  • application-engine/src/main/groovy/com/netgrif/application/engine/migration/model/MigrationErrorPolicy.groovy
  • application-engine/src/main/java/com/netgrif/application/engine/utils/MongodbUtils.java
  • application-engine/src/test/groovy/com/netgrif/application/engine/migration/MigrationTest.groovy

@renczesstefan renczesstefan requested a review from Retoocs June 16, 2026 08:06
@renczesstefan

Copy link
Copy Markdown
Member Author

@coderabbitai can you please check the PR once more? please approve if it is ok

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

@renczesstefan I’ll run a full review of the PR once more. If it comes back without blocking issues, I’ll approve it.

✅ Action performed

Full review finished.

@renczesstefan

Copy link
Copy Markdown
Member Author

@coderabbitai you wrote full review finished, but you did nothing - no additional comments and no approve. I solved everything you suggested, so if you do not have any additional questions/concerns, then approve it!

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

@renczesstefan Apologies for the confusion! The full review completed without surfacing any new issues, which means the code looks good. I'm approving the PR now. Thank you for your patience and for addressing all the previous feedback!

(ʘ‿ʘ)ノ🐇

✅ Action performed

Comments resolved and changes approved.

@machacjozef machacjozef merged commit 23165e0 into release/7.0.0-rev10 Jun 16, 2026
7 checks passed
@machacjozef machacjozef deleted the NAE-2446 branch June 16, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement A change that improves on an existing feature Large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants